Skip to content

Conversation

@CoderOMaster
Copy link

@CoderOMaster CoderOMaster commented Dec 23, 2025

Brief summary of the change made

Copied tests cases from OpenPAYGO-Token Repository (Archived), refactored them based on relevant imports, added error handling during hex decoding, copied and refactor device and service simulators and improved token encoding and decoding script to handle changes.
Link-> https://github.com/EnAccess/OpenPAYGO-Token.git

closes: #13

Are there any other side effects of this change that we should be aware of?

I do not think so

Describe how you tested your changes?

I have followed the readme.md to run my changes as well as pytest for original test to make sure it works

Pull Request checklist

Please confirm you have completed any of the necessary steps below.

  • Meaningful Pull Request title and description
  • Changes tested as described above
  • Added appropriate documentation for the change.
  • [N] Created GitHub issues for any relevant followup/future enhancements if appropriate.

Copy link
Member

@dmohns dmohns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks really good already! Left a couple of comments

Comment on lines +17 to +18
Create new issues in the
[issue tracker](https://github.com/EnAccess/OpenPAYGO-python/issues/new/choose)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't change this file. It's centrally managed for all our repositories 😉

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ahh I was getting linting error here for md I believe or smthg that's why had to change that as tests were failing but will see how I can fix it

Comment on lines +149 to +158
if isinstance(secret_key, (bytes, bytearray)):
secret_key_bytes = bytes(secret_key)
if len(secret_key_bytes) != 16:
raise ValueError(
"The secret key provided is not correctly formatted, it should be "
"16 "
"bytes. "
)
return secret_key_bytes

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you need to change code in the metrics part? Your changes are only touching Token tests, right?

Comment on lines -150 to +152
if not past_used_counts:
if past_used_counts is None:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this change required? It seem less "pythonic". Looks like you want to continue processing, when past_used_counts is an empty array, but exit the processing when None. Can you find a more descriptive way of achieving this?

Comment on lines +1 to +4
from .device_simulator import DeviceSimulator as DeviceSimulator
from .server_simulator import SingleDeviceServerSimulator as SingleDeviceServerSimulator

__all__ = ["DeviceSimulator", "SingleDeviceServerSimulator"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think these "Simulators" make sense as part of the core module. I know the legacy repository had it that way, but it wasn't ported to OpenPAYGO-python.

Could you move the simulators into the tests directory? As this is the only place where it's (meaningfully) used.

@dmohns
Copy link
Member

dmohns commented Jan 5, 2026

Hey @CoderOMaster

another comment: I have updated the library to use a more modern tooling uv. Could you update your README instructions accordingly? I.e. we no longer have to manually manage VENVs and stuff, as uv takes care of it.

Also, probably need to resolve merge conflicts. Apologies for the additional effort 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Port test cases from archived OpenPAYGO-Token repository

3 participants